﻿Module Module1

    Sub Main()
        Dim Q As New QBuilder.SelectQuery

        Q.TableName = "test"
        Q.Fields.Add("a")
        Q.Fields.Add("b")
        Q.Fields.Add("c")

        Q.AddCriteria(New QBuilder.Criteria("a", QBuilder.Criteria.Operation.EqualTo, "@Param1"))
        Q.AddCriteria(New QBuilder.Criteria("b", QBuilder.Criteria.Operation.EqualTo, "Value"))
        Q.AddCriteria(New QBuilder.BetweenCriteria("c", "56", "@Param2"))

        Dim subquery As New QBuilder.SelectQuery
        subquery.TableName = "SubTable"
        subquery.Fields.Add("count(*)")
        subquery.AddCriteria(New QBuilder.Criteria("Sub1", QBuilder.Criteria.Operation.EqualTo, "15"))

        Q.AddCriteria(New QBuilder.Criteria(subquery, QBuilder.Criteria.Operation.EqualTo, "2"))

        Console.WriteLine(Q.GetSQLText)
        Debug.WriteLine(Q.GetSQLText)

        Console.ReadLine()
    End Sub

End Module
